﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;

namespace DotNETX.GIS.Web.StaticTMS.Classes
{
    [XmlRoot("TileMap")]
    public class TileMap
    {
        [XmlAttribute("version")]
        public string Version { get; set; }

        [XmlElement("Title")]
        public string Title { get; set; }

        [XmlElement("Abstract")]
        public string Abstract { get; set; }

        [XmlElement("KeywordList")]
        public string KeywordList { get; set; }

        [XmlElement("SRS")]
        public string SRS { get; set; }

        [XmlElement("BoundingBox")]
        public BoundingBox BoundingBox { get; set; }

        [XmlElement("Origin")]
        public Origin Origin { get; set; }

        [XmlElement("TileFormat")]
        public TileFormat TileFormat { get; set; }

        [XmlArray("TileSets")]
        [XmlArrayItem("TileSet", typeof(TileSet))]
        public TileSet[] TileSets { get; set; } 
    }

    public class BoundingBox
    {
        [XmlAttribute("minx")]
        public double MinX { get; set; }
        [XmlAttribute("miny")]
        public double MinY { get; set; }
        [XmlAttribute("maxx")]
        public double MaxX { get; set; }
        [XmlAttribute("maxy")]
        public double MaxY { get; set; }
    }

    public class Origin
    {
        [XmlAttribute("x")]
        public double X { get; set; }
        [XmlAttribute("y")]
        public double Y { get; set; }
    }

    public class TileFormat
    {
        [XmlAttribute("width")]
        public int Width { get; set; }
        [XmlAttribute("height")]
        public int Height { get; set; }
        [XmlAttribute("mime-type")]
        public string MimeType { get; set; }
        [XmlAttribute("extension")]
        public string Extension { get; set; }
    }

    public class TileSet
    {
        [XmlAttribute("href")]
        public string Href { get; set; }

        [XmlAttribute("units-per-pixel")]
        public double UnitPerPixel { get; set; }

        [XmlAttribute("order")]
        public int Order { get; set; }
    }

}
